package cn.wolfcode.crmspringboot.service.impl;

import cn.wolfcode.crmspringboot.domain.Audition;
import cn.wolfcode.crmspringboot.domain.Content;
import cn.wolfcode.crmspringboot.domain.Title;
import cn.wolfcode.crmspringboot.mapper.AuditionMapper;
import cn.wolfcode.crmspringboot.query.QueryObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AuditionService {

    @Autowired
    private AuditionMapper auditionMapper;

    public PageInfo query(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<Audition> list = auditionMapper.query(qo);
        return new PageInfo(list,50);
    }

    public Title getDetails(String id) {
       Title title = auditionMapper.getInterview(id);
       List<Content> list = auditionMapper.getDetails(id);
       title.setContent(list);
        return title;
    }
}
